\doxysection{dmmotor.\+h}
\hypertarget{dmmotor_8h_source}{}\label{dmmotor_8h_source}\index{C:/Users/ASUS/Desktop/dm-\/ctrlH7-\/balance-\/9025test/modules/motor/DMmotor/dmmotor.h@{C:/Users/ASUS/Desktop/dm-\/ctrlH7-\/balance-\/9025test/modules/motor/DMmotor/dmmotor.h}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{preprocessor}{\#ifndef\ DMMOTOR\_H}}
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#define\ DMMOTOR\_H}}
\DoxyCodeLine{00003\ \textcolor{preprocessor}{\#include\ <stdint.h>}}
\DoxyCodeLine{00004\ \textcolor{preprocessor}{\#include\ "{}bsp\_can.h"{}}}
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{controller_8h}{controller.h}}"{}}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{motor__def_8h}{motor\_def.h}}"{}}}
\DoxyCodeLine{00007\ \textcolor{preprocessor}{\#include\ "{}daemon.h"{}}}
\DoxyCodeLine{00008\ }
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#define\ DM\_MOTOR\_CNT\ 4}}
\DoxyCodeLine{00010\ }
\DoxyCodeLine{00011\ \textcolor{preprocessor}{\#define\ DM\_P\_MIN\ \ (-\/12.5f)}}
\DoxyCodeLine{00012\ \textcolor{preprocessor}{\#define\ DM\_P\_MAX\ \ 12.5f}}
\DoxyCodeLine{00013\ \textcolor{preprocessor}{\#define\ DM\_V\_MIN\ \ (-\/45.0f)}}
\DoxyCodeLine{00014\ \textcolor{preprocessor}{\#define\ DM\_V\_MAX\ \ 45.0f}}
\DoxyCodeLine{00015\ \textcolor{preprocessor}{\#define\ DM\_T\_MIN\ \ (-\/18.0f)}}
\DoxyCodeLine{00016\ \textcolor{preprocessor}{\#define\ DM\_T\_MAX\ \ \ 18.0f}}
\DoxyCodeLine{00017\ }
\DoxyCodeLine{00018\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }}
\DoxyCodeLine{00019\ \{}
\DoxyCodeLine{00020\ \ \ \ \ uint8\_t\ id;}
\DoxyCodeLine{00021\ \ \ \ \ uint8\_t\ state;}
\DoxyCodeLine{00022\ \ \ \ \ \textcolor{keywordtype}{float}\ velocity;}
\DoxyCodeLine{00023\ \ \ \ \ \textcolor{keywordtype}{float}\ last\_position;}
\DoxyCodeLine{00024\ \ \ \ \ \textcolor{keywordtype}{float}\ position;}
\DoxyCodeLine{00025\ \ \ \ \ \textcolor{keywordtype}{float}\ torque;}
\DoxyCodeLine{00026\ \ \ \ \ \textcolor{keywordtype}{float}\ T\_Mos;}
\DoxyCodeLine{00027\ \ \ \ \ \textcolor{keywordtype}{float}\ T\_Rotor;}
\DoxyCodeLine{00028\ \ \ \ \ int32\_t\ total\_round;}
\DoxyCodeLine{00029\ \}\mbox{\hyperlink{struct_d_m___motor___measure__s}{DM\_Motor\_Measure\_s}};}
\DoxyCodeLine{00030\ }
\DoxyCodeLine{00031\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct}}
\DoxyCodeLine{00032\ \{}
\DoxyCodeLine{00033\ \ \ \ \ uint16\_t\ position\_des;}
\DoxyCodeLine{00034\ \ \ \ \ uint16\_t\ velocity\_des;}
\DoxyCodeLine{00035\ \ \ \ \ uint16\_t\ torque\_des;}
\DoxyCodeLine{00036\ \ \ \ \ uint16\_t\ Kp;}
\DoxyCodeLine{00037\ \ \ \ \ uint16\_t\ Kd;}
\DoxyCodeLine{00038\ \}\mbox{\hyperlink{struct_d_m_motor___send__s}{DMMotor\_Send\_s}};}
\DoxyCodeLine{00039\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }}
\DoxyCodeLine{00040\ \{}
\DoxyCodeLine{00041\ \ \ \ \ \mbox{\hyperlink{struct_d_m___motor___measure__s}{DM\_Motor\_Measure\_s}}\ measure;}
\DoxyCodeLine{00042\ \ \ \ \ \mbox{\hyperlink{struct_motor___control___setting__s}{Motor\_Control\_Setting\_s}}\ motor\_settings;}
\DoxyCodeLine{00043\ \ \ \ \ \mbox{\hyperlink{struct_p_i_d_instance}{PIDInstance}}\ current\_PID;}
\DoxyCodeLine{00044\ \ \ \ \ \mbox{\hyperlink{struct_p_i_d_instance}{PIDInstance}}\ speed\_PID;}
\DoxyCodeLine{00045\ \ \ \ \ \mbox{\hyperlink{struct_p_i_d_instance}{PIDInstance}}\ angle\_PID;}
\DoxyCodeLine{00046\ \ \ \ \ \textcolor{keywordtype}{float}\ *other\_angle\_feedback\_ptr;}
\DoxyCodeLine{00047\ \ \ \ \ \textcolor{keywordtype}{float}\ *other\_speed\_feedback\_ptr;}
\DoxyCodeLine{00048\ \ \ \ \ \textcolor{keywordtype}{float}\ *speed\_feedforward\_ptr;}
\DoxyCodeLine{00049\ \ \ \ \ \textcolor{keywordtype}{float}\ *current\_feedforward\_ptr;}
\DoxyCodeLine{00050\ \ \ \ \ \textcolor{keywordtype}{float}\ pid\_ref;}
\DoxyCodeLine{00051\ \ \ \ \ Motor\_Working\_Type\_e\ stop\_flag;}
\DoxyCodeLine{00052\ \ \ \ \ CANInstance\ *motor\_can\_instace;}
\DoxyCodeLine{00053\ \ \ \ \ DaemonInstance*\ motor\_daemon;}
\DoxyCodeLine{00054\ \ \ \ \ uint32\_t\ lost\_cnt;}
\DoxyCodeLine{00055\ \}\mbox{\hyperlink{struct_d_m_motor_instance}{DMMotorInstance}};}
\DoxyCodeLine{00056\ }
\DoxyCodeLine{00057\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{enum}}
\DoxyCodeLine{00058\ \{}
\DoxyCodeLine{00059\ \ \ \ \ DM\_CMD\_MOTOR\_MODE\ =\ 0xfc,\ \ \ \textcolor{comment}{//\ 使能,会响应指令}}
\DoxyCodeLine{00060\ \ \ \ \ DM\_CMD\_RESET\_MODE\ =\ 0xfd,\ \ \ \textcolor{comment}{//\ 停止}}
\DoxyCodeLine{00061\ \ \ \ \ DM\_CMD\_ZERO\_POSITION\ =\ 0xfe,\ \textcolor{comment}{//\ 将当前的位置设置为编码器零位}}
\DoxyCodeLine{00062\ \ \ \ \ DM\_CMD\_CLEAR\_ERROR\ =\ 0xfb\ \textcolor{comment}{//\ 清除电机过热错误}}
\DoxyCodeLine{00063\ \}DMMotor\_Mode\_e;}
\DoxyCodeLine{00064\ }
\DoxyCodeLine{00065\ \mbox{\hyperlink{struct_d_m_motor_instance}{DMMotorInstance}}\ *DMMotorInit(\mbox{\hyperlink{struct_motor___init___config__s}{Motor\_Init\_Config\_s}}\ *config);}
\DoxyCodeLine{00066\ }
\DoxyCodeLine{00067\ \textcolor{keywordtype}{void}\ DMMotorSetRef(\mbox{\hyperlink{struct_d_m_motor_instance}{DMMotorInstance}}\ *motor,\ \textcolor{keywordtype}{float}\ ref);}
\DoxyCodeLine{00068\ }
\DoxyCodeLine{00069\ \textcolor{keywordtype}{void}\ DMMotorOuterLoop(\mbox{\hyperlink{struct_d_m_motor_instance}{DMMotorInstance}}\ *motor,\mbox{\hyperlink{motor__def_8h_a306d656c63a2d986e7aff57a0526395d}{Closeloop\_Type\_e}}\ closeloop\_type);}
\DoxyCodeLine{00070\ }
\DoxyCodeLine{00071\ \textcolor{keywordtype}{void}\ DMMotorEnable(\mbox{\hyperlink{struct_d_m_motor_instance}{DMMotorInstance}}\ *motor);}
\DoxyCodeLine{00072\ }
\DoxyCodeLine{00073\ \textcolor{keywordtype}{void}\ DMMotorStop(\mbox{\hyperlink{struct_d_m_motor_instance}{DMMotorInstance}}\ *motor);}
\DoxyCodeLine{00074\ \textcolor{keywordtype}{void}\ DMMotorCaliEncoder(\mbox{\hyperlink{struct_d_m_motor_instance}{DMMotorInstance}}\ *motor);}
\DoxyCodeLine{00075\ \textcolor{keywordtype}{void}\ DMMotorControlInit();}
\DoxyCodeLine{00076\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ !DMMOTOR}}

\end{DoxyCode}
